import {message, Modal} from 'antd'
import dva from 'dva';
import createLoading from 'dva-loading'
import createHistory from 'history/createBrowserHistory'
import 'babel-polyfill'

// 1. Initialize
const app = dva({
    ...createLoading({effects: true}),
    history: createHistory(),
    // 抛出错误
    onError(error) {
        console.log(error)
        // message.error(error.message)
        Modal.error({title: '请求出错了', content: error.message})
    }
})

// 2. Plugins app.use({});

// 3. Model
app.model(require('./models/app'))

// 4. Router
app.router(require('./router'))

// 5. Start
app.start('#root');
